@extends('system.frame_layout')
<?php $parent_menu = "财务中心"; $menu_selected = "申请报单中心";?>

@section('content')
    <div id="content-panel">
        <div class="row">
            <div class="col-xs-12">
                <div class="portlet light bordered">
                    <div class="portlet-title">
                        <div class="caption">
                            <i class="icon-social-dribbble font-dark hide"></i>
                            <span class="caption-subject font-dark bold">申请报单中心 Apply For Activate User</span>
                        </div>
                    </div>
                    <div class="portlet-body">
                        <form id="bdzx" method="post" action="{{route('sys.bdzx.act')}}">
                            {{csrf_field()}}
                            <div class="form-group">
                                <div class="form-body">

                                    <div class="alert alert-success">
                                        <strong>申请须知：</strong>
                                        申请报单中心之前请确保您的账户有10000奖金币，申请提交之后，奖金币将会自动从您的账户扣除，并晋升您为报单中心！
                                    </div>
                                    @if($user->bdzx_status != \App\Models\MUser::$BDZX_YES)
                                        <div class="row input-row">
                                            <label class="col-xs-12 title" for="exampleInputPassword1">
                                                交易密码 - Safe Pass
                                            </label>
                                            <div class="col-md-4 col-xs-12">
                                                <div class="input-group">
                                                    <span class="input-group-addon">
                                                        <i class="iconfont icon-bixuan-copy font-red"></i>
                                                    </span>
                                                    <input name="safepass" type="password" class="form-control"
                                                           placeholder="请输入您的交易密码">
                                                </div>
                                            </div>
                                            <div class="col-xs-12 col-md-6">
                                                <label for="safepass" class="label-intro"></label>
                                            </div>
                                        </div>

                                        <div class="row input-row">
                                            <div class="col-xs-12">
                                                <button type="submit" class="btn blue-madison">
                                                    <i class="iconfont icon-duihao"></i>&nbsp;立即申请
                                                </button>
                                            </div>
                                        </div>
                                    @else
                                        <div class="alert alert-success">
                                            <strong>您已经是报单中心会员！</strong>
                                        </div>
                                    @endif
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('footer')
    <script>
        $("#bdzx").validate({
            rules: {
                safepass: {
                    required: true
                }
            }, errorPlacement: function (error, element) {
                $(element).closest("form").find("label[for='" + element.attr("name") + "']").html(error);
            },
            submitHandler: function (form) {
                $(form).ajaxSubmit({
                    dataType: "json",
                    type: "post",
                    success: function (data) {
                        if (data.code == 0) {
                            toastr["success"](data.msg);
                            setInterval(function () {
                                window.location.reload();
                            }, 2000);
                        } else {
                            toastr["error"](data.msg);
                        }
                    }
                });
            }
        });
    </script>
@endsection